package models;

import java.util.Date;

import siena.Column;
import siena.Generator;
import siena.Id;
import siena.Model;
import siena.Query;
import siena.Table;

/**
 * 账户明细记录
 * @author 高恒
 *
 */
@Table("account_item")
public class AccountItem extends Model {
	
	@Id(Generator.AUTO_INCREMENT)
	public Long id;
	
	/**
	 * 账户id
	 */
	@Column("account_id")
	public Long accountId;
	
	/**
	 * 详细信息
	 */
	@Column("detail")
	public String detail;
	
	/**
	 * 类型
	 */
	@Column("direction")
	public FundsFlowDirection direction;
	
	/**
	 * 收入支出记录id
	 */
	@Column("ip_record_id")
	public Long ipRecordId;
	
	/**
	 * 金额
	 */
	@Column("amount")
	public Double amount;
	
	/**
	 * 创建时间
	 */
	@Column("create_time")
	public Date createTime;
		
	public AccountItem(Long accountId, String detail, FundsFlowDirection direction, Double amount) {
		super();
		this.accountId = accountId;
		this.detail = detail;
		this.direction = direction;
		this.amount = amount;
		createTime = new Date();
	}

	public static Query<AccountItem> all() {
		return Model.all(AccountItem.class);
	}

}
